package com.dotstone.chipism.activity;

import com.dotstone.chipism.R;
import com.dotstone.chipism.bean.DeviceType;
import com.dotstone.chipism.view.slidingfragmenu.BarUtils;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class AddDeviceTypeSelectionActivity extends BaseActivity {
	private LinearLayout mBackL;
	private TextView mTitleT;
	private Button mSwitchB;
	private Button mSocketB;
	private Button mLightB;
	private Button mLockB;
	private Button mRemoteB;
	private TextView tv_statusBar_mian;
	public static AddDeviceTypeSelectionActivity addDeviceTypeSelectionActivity;
	private Button wirelsess_switch_btn;
	private Button linghuo_switch_btn;
	private Button danhuo_switch_btn;
	private Button chazuo_btn;

	@Override
	public void widgetClick(View v) {
		// TODO Auto-generated method stub
		Intent intent;
		switch (v.getId()) {
            case R.id.back_layout:
    //			intent = new Intent(getApplicationContext(),WlanSelectionActivity.class);
    //			startActivity(intent);
                finish();
                break;
            case R.id.switch_btn:
                intent = new Intent(getApplicationContext(),SwitchTypeSelectActivity.class);
                intent.putExtra("type", DeviceType.DEVICE_TYPE_SWITCH);
                startActivity(intent);
                finish();
    //			ToastShow.Show(getApplicationContext(), "尚待完善");
                break;
            case R.id.socket_btn:
                intent = new Intent(getApplicationContext(),SocketTypeSelectActivity.class);
                intent.putExtra("type", DeviceType.DEVICE_TYPE_SOCKET);
                startActivity(intent);
                finish();
                break;
            case R.id.light_btn:
                intent = new Intent(getApplicationContext(),SearchDeviceActivity2.class);
                intent.putExtra("type", DeviceType.DEVICE_TYPE_RGB_LIGHT);
                startActivity(intent);
                finish();
                break;
			case R.id.curtain_btn:
                intent = new Intent(getApplicationContext(),SearchDeviceActivity2.class);
                intent.putExtra("type", DeviceType.DEVICE_TYPE_CURTAIN);
                startActivity(intent);
                finish();
                break;
            case R.id.lock_btn:
                intent = new Intent(getApplicationContext(),AddLockActivity.class);
                intent.putExtra("type", DeviceType.DEVICE_TYPE_LOCK);
                startActivity(intent);
                finish();
//			ToastShow.Show(getApplicationContext(), "尚待完善");
			
			break;
            case R.id.wirelsess_switch_btn:
                intent = new Intent(getApplicationContext(),WirelessTypeSelectActivity.class);
               // intent.putExtra("type", DeviceType.WIRELSEE_SWITCH);
                startActivity(intent);
                finish();
			break;
            case R.id.linghuo_switch_btn:
                intent = new Intent(getApplicationContext(),LingHuoTypeSelectActivity.class);
               // intent.putExtra("type", DeviceType.WIRELSEE_SWITCH);
                startActivity(intent);
                finish();
			break;
            case R.id.danhuo_switch_btn:
                intent = new Intent(getApplicationContext(),DanHuoTypeSelectActivity.class);
               // intent.putExtra("type", DeviceType.WIRELSEE_SWITCH);
                startActivity(intent);
                finish();
			break;
            case R.id.chazuo_btn:
                intent = new Intent(getApplicationContext(),SearchDeviceActivity2.class);
                 intent.putExtra("type", DeviceType.DEVICE_TYPE_CHAZUO);
                startActivity(intent);
                finish();
			break;
		case R.id.remote_btn:
			intent = new Intent(getApplicationContext(),RemoteSelectionActivity.class);
			startActivity(intent);
			break;
		default:
			break;
		}
	}

	@Override
	public void initParms(Bundle parms) {
		// TODO Auto-generated method stub

	}

	@Override
	public View bindView() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int bindLayout() {
		// TODO Auto-generated method stub
		return R.layout.activity_add_device_type_selection;
	}

	@Override
	public void initView(View view) {
		// TODO Auto-generated method stub
		addDeviceTypeSelectionActivity = this;
		mBackL = $(R.id.back_layout);
		mTitleT = $(R.id.title_tv);
		mTitleT.setVisibility(View.GONE);
		mSwitchB = $(R.id.switch_btn);
		mSocketB = $(R.id.socket_btn);
		mLightB = $(R.id.light_btn);
		mLockB = $(R.id.lock_btn);
		mRemoteB = $(R.id.remote_btn);
		wirelsess_switch_btn = $(R.id.wirelsess_switch_btn);
		linghuo_switch_btn = $(R.id.linghuo_switch_btn);
		danhuo_switch_btn = $(R.id.danhuo_switch_btn);
		chazuo_btn = $(R.id.chazuo_btn);
		tv_statusBar_mian = $(R.id.tv_statusBar_mian);
		mBackL.setOnClickListener(this);
		mSwitchB.setOnClickListener(this);
		mSocketB.setOnClickListener(this);
		mLightB.setOnClickListener(this);
		mLockB.setOnClickListener(this);
		mRemoteB.setOnClickListener(this);
		wirelsess_switch_btn.setOnClickListener(this);
		linghuo_switch_btn.setOnClickListener(this);
		danhuo_switch_btn.setOnClickListener(this);
		chazuo_btn.setOnClickListener(this);
		findViewById(R.id.curtain_btn).setOnClickListener(this);
		boolVersion();
	}
	
	public void boolVersion() {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
			Window window = getWindow();
			window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
					WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
			// 透明导航栏
//			getWindow().addFlags(
//					WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
			// 改变titlebar的高度
			int statusbarHeight = BarUtils.getStatusBarHeight(this);
			RelativeLayout.LayoutParams layoutParams1 = (RelativeLayout.LayoutParams) tv_statusBar_mian
					.getLayoutParams();
			layoutParams1.height = statusbarHeight;
			tv_statusBar_mian.setLayoutParams(layoutParams1);
			tv_statusBar_mian.setVisibility(View.VISIBLE);
		} else {
			tv_statusBar_mian.setVisibility(View.GONE);
		}
	}

	@Override
	public void setListener() {
		// TODO Auto-generated method stub

	}

	@Override
	public void doBusiness(Context mContext) {
		// TODO Auto-generated method stub

	}

}
